<template>
  <div class="container">
    <van-nav-bar
      fixed
      title="分类"
    />
    <van-grid
      :gutter="20"
      :column-num="2"
    >
      <van-grid-item
        :class="['fa',item.icon]"
        :text="item.catename"
        v-for="(item,index) in cateList"
        :key="item.id"
        @click="$router.push({path:'/list',query:{
        id:item.id,index:index
      }})"
      />
    </van-grid>
  </div>
</template>

<script>
import { getcate } from '../api/cate'
export default {
  data () {
    return {
      cateList: []
    }
  },
  async created () {
    const res = await getcate()
    console.log(res);
    this.cateList = res.data.allCate
   
  },
  methods: {
  
  }
}
</script>

<style scoped lang="less">
.fa:before {
  position: relative;
  top:70px;
  left: 100px;
  z-index: 999;
}
.van-grid {
  margin-top: 40px;
}
</style>